<?php

/**
 * Created by PhpStorm.
 * User: ChengChaogui
 * Date: 2016/11/27
 * Time: 15:28
 */

namespace App\Framework\Model;

class LoginedManager
{
    private $manager_id;
    private $username;
    private $role_id;
    private $role_name;
    private $real_name;
    private $modules;
    private $permissions;
    private $permissionMap;

    public function __construct($manager_id, $username, $role_id, $role_name, $real_name, $modules, $permissions)
    {
        $this->manager_id = $manager_id;
        $this->username = $username;
        $this->role_id = $role_id;
        $this->role_name = $role_name;
        $this->real_name = $real_name;
        $this->modules = $modules;
        $this->permissions = $permissions;
        $this->permissionMap = [];

        foreach ($permissions as $item) {
            $this->permissionMap[$item->manager_module_id] = $item->permission_value;
        }
    }

    public function getManagerID()
    {
        return $this->manager_id;
    }

    public function getUsername()
    {
        return $this->username;
    }

    public function getRoleID()
    {
        return $this->role_id;
    }

    public function getRoleName()
    {
        return $this->role_name;
    }

    public function getRealName()
    {
        return $this->real_name;
    }

    public function getModules()
    {
        return $this->modules;
    }

    public function getPermissions()
    {
        return $this->permissions;
    }

    public function getPermissionMap()
    {
        return $this->permissionMap;
    }
}